package CocJUnit;
/**
 * 
 * @version 1.0
 * @author Usuario
 *
 */
public class Testcoc {
	public static String Caraocruz(int n1, String cadena){
		/**
		 * clase cara o cruz, hace todas las operaciones
		 */
		String ganador = "";
		String[] caraocruz = cadena.split(" ");
		if (n1>0){
			if (cadena.replaceAll(" ", "").matches("[1-9]{1}([0-9]*)")){
				for(int i=0; i<n1; i++){
					int john=0;
					int mary=0;
					if(Integer.parseInt(caraocruz[i])==1){
						john = john + 1;
					}else{
						mary = mary + 1;
					}
					ganador += "Mary won " + mary + " times and John won " + john + " times\n"; 
				}
			}else{
				System.out.println("caracteres invalidos");
			}
		}else{
			System.out.println("caracteres invalidos");
		}
		return ganador;
	}
}
 